<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>uvgRTP: uvg_rtp::media_stream Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">uvgRTP
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>uvg_rtp</b></li><li class="navelem"><a class="el" href="classuvg__rtp_1_1media__stream.html">media_stream</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classuvg__rtp_1_1media__stream-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">uvg_rtp::media_stream Class Reference</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a437f744c867120d1306b610fb3a14b0d"><td class="memItemLeft" align="right" valign="top"><a id="a437f744c867120d1306b610fb3a14b0d"></a>
rtp_error_t&#160;</td><td class="memItemRight" valign="bottom"><b>add_srtp_ctx</b> (uint8_t *key, uint8_t *salt)</td></tr>
<tr class="separator:a437f744c867120d1306b610fb3a14b0d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac4c9fd2a2dbe2ae2695063eaa094e5d7"><td class="memItemLeft" align="right" valign="top">rtp_error_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classuvg__rtp_1_1media__stream.html#ac4c9fd2a2dbe2ae2695063eaa094e5d7">push_frame</a> (uint8_t *data, size_t data_len, int flags)</td></tr>
<tr class="separator:ac4c9fd2a2dbe2ae2695063eaa094e5d7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a16ee929848fea872be0a84a9f99e7a1b"><td class="memItemLeft" align="right" valign="top"><a id="a16ee929848fea872be0a84a9f99e7a1b"></a>
rtp_error_t&#160;</td><td class="memItemRight" valign="bottom"><b>push_frame</b> (uint8_t *data, size_t data_len, uint32_t ts, int flags)</td></tr>
<tr class="separator:a16ee929848fea872be0a84a9f99e7a1b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afc487d2d93bdb4c45677e9b0d7d8bbc8"><td class="memItemLeft" align="right" valign="top"><a id="afc487d2d93bdb4c45677e9b0d7d8bbc8"></a>
rtp_error_t&#160;</td><td class="memItemRight" valign="bottom"><b>push_frame</b> (std::unique_ptr&lt; uint8_t[]&gt; data, size_t data_len, int flags)</td></tr>
<tr class="separator:afc487d2d93bdb4c45677e9b0d7d8bbc8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af90f7ec244868c9dbdba34027afbcbe2"><td class="memItemLeft" align="right" valign="top"><a id="af90f7ec244868c9dbdba34027afbcbe2"></a>
rtp_error_t&#160;</td><td class="memItemRight" valign="bottom"><b>push_frame</b> (std::unique_ptr&lt; uint8_t[]&gt; data, size_t data_len, uint32_t ts, int flags)</td></tr>
<tr class="separator:af90f7ec244868c9dbdba34027afbcbe2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a78d74338ee1b0ce41062e312e23be7ee"><td class="memItemLeft" align="right" valign="top">uvg_rtp::frame::rtp_frame *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classuvg__rtp_1_1media__stream.html#a78d74338ee1b0ce41062e312e23be7ee">pull_frame</a> ()</td></tr>
<tr class="memdesc:a78d74338ee1b0ce41062e312e23be7ee"><td class="mdescLeft">&#160;</td><td class="mdescRight">Poll a frame indefinetily from the media stream object.  <a href="classuvg__rtp_1_1media__stream.html#a78d74338ee1b0ce41062e312e23be7ee">More...</a><br /></td></tr>
<tr class="separator:a78d74338ee1b0ce41062e312e23be7ee"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae1abb68fe04b8885457591456a557c8c"><td class="memItemLeft" align="right" valign="top">uvg_rtp::frame::rtp_frame *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classuvg__rtp_1_1media__stream.html#ae1abb68fe04b8885457591456a557c8c">pull_frame</a> (size_t timeout)</td></tr>
<tr class="memdesc:ae1abb68fe04b8885457591456a557c8c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Poll a frame for a specified time from the media stream object.  <a href="classuvg__rtp_1_1media__stream.html#ae1abb68fe04b8885457591456a557c8c">More...</a><br /></td></tr>
<tr class="separator:ae1abb68fe04b8885457591456a557c8c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a219659f2ebdbcefb2d1156e8703214b9"><td class="memItemLeft" align="right" valign="top">rtp_error_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classuvg__rtp_1_1media__stream.html#a219659f2ebdbcefb2d1156e8703214b9">install_receive_hook</a> (void *arg, void(*hook)(void *, uvg_rtp::frame::rtp_frame *))</td></tr>
<tr class="separator:a219659f2ebdbcefb2d1156e8703214b9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3316a89869b321774ed726157e1f3c89"><td class="memItemLeft" align="right" valign="top">rtp_error_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classuvg__rtp_1_1media__stream.html#a3316a89869b321774ed726157e1f3c89">configure_ctx</a> (int flag, ssize_t value)</td></tr>
<tr class="memdesc:a3316a89869b321774ed726157e1f3c89"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configure the media stream, see <a class="el" href="util_8hh.html#aa98d9238629e33567e73af0d239e587f" title="RTP context configuration flags.">RTP_CTX_CONFIGURATION_FLAGS</a> for more details.  <a href="classuvg__rtp_1_1media__stream.html#a3316a89869b321774ed726157e1f3c89">More...</a><br /></td></tr>
<tr class="separator:a3316a89869b321774ed726157e1f3c89"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2d655dce6396710b4212c1213c6f3a70"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classuvg__rtp_1_1rtcp.html">uvg_rtp::rtcp</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classuvg__rtp_1_1media__stream.html#a2d655dce6396710b4212c1213c6f3a70">get_rtcp</a> ()</td></tr>
<tr class="memdesc:a2d655dce6396710b4212c1213c6f3a70"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get pointer to the RTCP object of the media stream.  <a href="classuvg__rtp_1_1media__stream.html#a2d655dce6396710b4212c1213c6f3a70">More...</a><br /></td></tr>
<tr class="separator:a2d655dce6396710b4212c1213c6f3a70"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a3316a89869b321774ed726157e1f3c89"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3316a89869b321774ed726157e1f3c89">&#9670;&nbsp;</a></span>configure_ctx()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">rtp_error_t uvg_rtp::media_stream::configure_ctx </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>flag</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">ssize_t&#160;</td>
          <td class="paramname"><em>value</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Configure the media stream, see <a class="el" href="util_8hh.html#aa98d9238629e33567e73af0d239e587f" title="RTP context configuration flags.">RTP_CTX_CONFIGURATION_FLAGS</a> for more details. </p>
<dl class="section return"><dt>Returns</dt><dd>RTP error code</dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">RTP_OK</td><td>On success </td></tr>
    <tr><td class="paramname">RTP_INVALID_VALUE</td><td>If the provided value is not valid for a given configuration flag </td></tr>
    <tr><td class="paramname">RTP_INVALID_VALUE</td><td>If the provided configuration flag is not supported </td></tr>
    <tr><td class="paramname">RTP_GENERIC_ERROR</td><td>If setsockopt(2) failed </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a2d655dce6396710b4212c1213c6f3a70"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2d655dce6396710b4212c1213c6f3a70">&#9670;&nbsp;</a></span>get_rtcp()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classuvg__rtp_1_1rtcp.html">uvg_rtp::rtcp</a>* uvg_rtp::media_stream::get_rtcp </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get pointer to the RTCP object of the media stream. </p>
<p>This object is used to control all RTCP-related functionality and RTCP documentation can be found from <a class="el" href="classuvg__rtp_1_1rtcp.html">uvg_rtp::rtcp</a></p>
<dl class="section return"><dt>Returns</dt><dd>Pointer to RTCP object</dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">uvg_rtp::rtcp*</td><td>If RTCP has been enabled (RCE_RTCP has been given to <a class="el" href="classuvg__rtp_1_1session.html#af083d3908e337ad5f58a2edc317e18d4" title="Create a bidirectional media stream for an RTP session.">uvg_rtp::session::create_stream()</a>) </td></tr>
    <tr><td class="paramname">nullptr</td><td>If RTCP has not been enabled </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a219659f2ebdbcefb2d1156e8703214b9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a219659f2ebdbcefb2d1156e8703214b9">&#9670;&nbsp;</a></span>install_receive_hook()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">rtp_error_t uvg_rtp::media_stream::install_receive_hook </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>arg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void(*)(void *, uvg_rtp::frame::rtp_frame *)&#160;</td>
          <td class="paramname"><em>hook</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Alternative to <a class="el" href="classuvg__rtp_1_1media__stream.html#a78d74338ee1b0ce41062e312e23be7ee" title="Poll a frame indefinetily from the media stream object.">pull_frame()</a>. The provided hook is called when a frame is received.</p>
<p>"arg" is optional argument that is passed to hook when it is called. It may be nullptr</p>
<p>NOTE: Hook should not be used to process the frame but it should be a place where the frame handout happens from uvgRTP to application</p>
<p>Return RTP_OK on success Return RTP_INVALID_VALUE if "hook" is nullptr </p>

</div>
</div>
<a id="a78d74338ee1b0ce41062e312e23be7ee"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a78d74338ee1b0ce41062e312e23be7ee">&#9670;&nbsp;</a></span>pull_frame() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uvg_rtp::frame::rtp_frame* uvg_rtp::media_stream::pull_frame </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Poll a frame indefinetily from the media stream object. </p>
<p>When a frame is received, it is put into the frame vector of the receiver Calling application can poll frames by calling <a class="el" href="classuvg__rtp_1_1media__stream.html#a78d74338ee1b0ce41062e312e23be7ee" title="Poll a frame indefinetily from the media stream object.">pull_frame()</a>.</p>
<p>NOTE: <a class="el" href="classuvg__rtp_1_1media__stream.html#a78d74338ee1b0ce41062e312e23be7ee" title="Poll a frame indefinetily from the media stream object.">pull_frame()</a> is a blocking operation and a separate thread should be spawned for it!</p>
<p>You can specify for how long should <a class="el" href="classuvg__rtp_1_1media__stream.html#a78d74338ee1b0ce41062e312e23be7ee" title="Poll a frame indefinetily from the media stream object.">pull_frame()</a> block by giving "timeout" parameter that denotes how long <a class="el" href="classuvg__rtp_1_1media__stream.html#a78d74338ee1b0ce41062e312e23be7ee" title="Poll a frame indefinetily from the media stream object.">pull_frame()</a> will wait for an incoming frame in milliseconds</p>
<p>Return pointer to RTP frame on success </p>

</div>
</div>
<a id="ae1abb68fe04b8885457591456a557c8c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae1abb68fe04b8885457591456a557c8c">&#9670;&nbsp;</a></span>pull_frame() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uvg_rtp::frame::rtp_frame* uvg_rtp::media_stream::pull_frame </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>timeout</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Poll a frame for a specified time from the media stream object. </p>
<p>When a frame is received, it is put into the frame vector of the receiver Calling application can poll frames by calling <a class="el" href="classuvg__rtp_1_1media__stream.html#a78d74338ee1b0ce41062e312e23be7ee" title="Poll a frame indefinetily from the media stream object.">pull_frame()</a>.</p>
<p>NOTE: <a class="el" href="classuvg__rtp_1_1media__stream.html#a78d74338ee1b0ce41062e312e23be7ee" title="Poll a frame indefinetily from the media stream object.">pull_frame()</a> is a blocking operation and a separate thread should be spawned for it!</p>
<p>You can specify for how long should <a class="el" href="classuvg__rtp_1_1media__stream.html#a78d74338ee1b0ce41062e312e23be7ee" title="Poll a frame indefinetily from the media stream object.">pull_frame()</a> block by giving "timeout" parameter that denotes how long <a class="el" href="classuvg__rtp_1_1media__stream.html#a78d74338ee1b0ce41062e312e23be7ee" title="Poll a frame indefinetily from the media stream object.">pull_frame()</a> will wait for an incoming frame in milliseconds</p>
<p>Return pointer to RTP frame on success </p>

</div>
</div>
<a id="ac4c9fd2a2dbe2ae2695063eaa094e5d7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac4c9fd2a2dbe2ae2695063eaa094e5d7">&#9670;&nbsp;</a></span>push_frame()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">rtp_error_t uvg_rtp::media_stream::push_frame </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>data_len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>flags</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Split "data" into 1500 byte chunks and send them to remote</p>
<p>NOTE: If SCD has been enabled, calling this version of <a class="el" href="classuvg__rtp_1_1media__stream.html#ac4c9fd2a2dbe2ae2695063eaa094e5d7">push_frame()</a> requires either that the caller has given a deallocation callback to SCD OR that "flags" contains flags "RTP_COPY"</p>
<p>NOTE: Each <a class="el" href="classuvg__rtp_1_1media__stream.html#ac4c9fd2a2dbe2ae2695063eaa094e5d7">push_frame()</a> sends one discrete frame of data. If the input frame is fragmented, calling application should call <a class="el" href="classuvg__rtp_1_1media__stream.html#ac4c9fd2a2dbe2ae2695063eaa094e5d7">push_frame()</a> with RTP_MORE and RTP_SLICE flags to prevent uvgRTP from flushing the frame queue after <a class="el" href="classuvg__rtp_1_1media__stream.html#ac4c9fd2a2dbe2ae2695063eaa094e5d7">push_frame()</a>.</p>
<p>push_frame(..., RTP_MORE | RTP_SLICE); // more data coming in, do not flush queue push_frame(..., RTP_MORE | RTP_SLICE); // more data coming in, do not flush queue push_frame(..., RTP_SLICE); // no more data coming in, flush queue</p>
<p>If user wishes to manage RTP timestamps himself, he may pass "ts" to <a class="el" href="classuvg__rtp_1_1media__stream.html#ac4c9fd2a2dbe2ae2695063eaa094e5d7">push_frame()</a> which forces uvgRTP to use that timestamp for all RTP packets of "data".</p>
<p>Return RTP_OK success Return RTP_INVALID_VALUE if one of the parameters are invalid Return RTP_MEMORY_ERROR if the data chunk is too large to be processed Return RTP_SEND_ERROR if uvgRTP failed to send the data to remote Return RTP_GENERIC_ERROR for any other error condition </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>include/<a class="el" href="media__stream_8hh_source.html">media_stream.hh</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
